#include<iostream>

using namespace std;

int lowbit(int x) {
    return x & -x;
}

const int maxn = 100000;
int num[maxn];
int n;

int main() {
    int res = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> num[i];
    }
    for (int i = 0; i < n; i++) {
        res = 0;
        while (num[i]) {
            num[i] -= lowbit(num[i]);
            res++;
        }
        printf("%d ", res);

    }
    return 0;
}